home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / tspa3540.zip / TSUNTA.INT < prev    next >
Text File  |  1996-09-07  |  5KB  |  112 lines

  1. (*
  2. Timo Salmi UNiT A
  3. A Turbo Pascal unit for sideways scrolling (panning)
  4. All rights reserved 22-Jul-89
  5. Updated 28-Jul-89, 19-Aug-89, 17-Mar-90, 15-Jul-90
  6.  
  7. The compiler tp 4.0 / 5.0 / 5.5 compatible directives which were used at
  8. complile-time as show below:
  9. *)
  10.  
  11. {$B-}     (* Short circuit boolean evaluation *)
  12. {$D-}     (* No bebug information *)
  13. {$F-}     (* Force far calls off *)
  14. {$I+}     (* Input/output checking on *)
  15. {$N-}     (* No numeric coprocessor *)
  16. {$R-}     (* No range-checking *)
  17. {$S+}     (* Stack overflow checking *)
  18. {$V+}     (* Strict var-string checking *)
  19.  
  20. (*
  21. There are many excellent (mostly commercial) Turbo Pascal units available,
  22. such as Turbo Power's Turbo Professional with hosts of useful procedures
  23. and functions. However, I have not come upon procedures which would scroll
  24. a screen, or part of the screen, SIDEWAYS. So here is a Turbo Pascal unit
  25. for vertical scrolling. It uses direct moves of memory, and is very fast.
  26. Because of this method, the older CGAs may experience snow.
  27.  
  28. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  29. NON-INSTITUTIONAL purposes, provided it is not changed in any way, and
  30. that a proper attribution is made. For ANY other usage, such as use in a
  31. business enterprise or at a university, contact the author for the terms
  32. of registration.
  33.  
  34. The units are under development. Comments and contacts are solicited. If
  35. you have any feedback about this unit, please do not hesitate to use
  36. electronic mail for communication.
  37.  
  38. The author shall not be liable to the user for any direct, indirect or
  39. consequential loss arising from the use of, or inability to use, any unit,
  40. program or file howsoever caused. No warranty is given that the units and
  41. programs will work under all circumstances.
  42.  
  43. Timo Salmi (email: ts@uwasa.fi WWW: http://uwasa.fi/~ts/)
  44. Professor of Accounting and Business Finance
  45. Faculty of Accounting & Industrial Management
  46. University of Vaasa
  47. P.O. BOX 700, FIN-65101 Vaasa, Finland
  48. *)
  49.  
  50. unit TSUNTA;
  51.  
  52. (* ======================================================================= *)
  53.                           interface
  54. (* ======================================================================= *)
  55.  
  56. uses Dos,
  57.      Crt,
  58.      TSUNTE;
  59.  
  60. (* Procedure for vertical scrolling moving right.
  61.    The area to be panned is defined by x1, y1, x2, y2.
  62.    The move sideways can be taken in strides by defining a step > 1.
  63.    If the parameters are invalid (say x1 = 100), the program is
  64.    aborted with and error message. Step = 0 is invalid.
  65.    Use in text mode only.
  66.    The width 40/80 of the text mode is detected by the unit unless
  67.    you toggle the texmode.
  68.    The (maximum) hight is 25 rows.
  69. *)
  70. procedure PANMR (x1, y1, x2, y2, step : byte);
  71.  
  72. (* Procedure for vertical scroll moving left *)
  73. procedure PANML (x1, y1, x2, y2, step : byte);
  74.  
  75. (* The width of the text screen
  76.    You do not necessarily need this in using panmr and panml because they
  77.    take care of the width themselves. Consider it a perk :-) *)
  78. function WIDTHFN : byte;
  79.  
  80. (* This is supposed to be the height of the text screen. Actually, it seems
  81.    to give the resolution 25, 43, or 50.  Whether that is the true height
  82.    of the screen depends on your application. This function is has no
  83.    connection with panning. It is here because it best belongs to this unit
  84.    along with widthfn *)
  85. function HIGHTFN : byte;
  86.  
  87. (*
  88. Each of the 80x25 (or 40x25) locations of a text-screen have in video
  89. memory an information byte on the character and its attribute, that is
  90. color starting from 0 black, 1 blue, and so on. Here are the means of
  91. access. One particularly useful trick is to write to location 80,25
  92. directly, since then the screen will not scroll as it would were you
  93. to use GoToXY (80,25); write ('X'); Furthermore, direct screen writes
  94. enable writing the ascii 0-31 characters without their special meaning.
  95. This fact can be utilized to widen the displayable character set.
  96. *)
  97.  
  98. (* A function to calculate a color attribute for VIDXY *)
  99. function ATTRIBFN (fgColor, bgColor : byte) : byte;
  100.  
  101. (* Write a single character ch at (column,row) using attribute,
  102.    directly to the video memory. If you do not know how the attribute
  103.    is defined for video memory, use the attribfn function *)
  104. procedure VIDXY (column, row : byte; ch : char; attrib : byte);
  105.  
  106. (* Read a single character from video memory *)
  107. function VDCHXYFN (column, row : byte) : char;
  108.  
  109. (* Read a single attribute from video memory *)
  110. function VDATXYFN (column, row : byte) : byte;
  111.  
  112.